<template>
	<view class="">
		<view class="calc150 overauto h498 bgcontain no-repeat"
			:style="{ backgroundImage: 'url(' + cosImageUrl('head_bg.png',true) + ')' }">
			<!-- #ifdef H5 -->
			<view class="pb40"></view>
			<!-- #endif -->
			<view class="" :style="{'paddingTop':statusBarHeigh + 'px',}">
				<view class="flex alicen pl20" :style="{'height':menuButtonInfo.height + 'px',}">
					<image class="w30b h48" :src="cosImageUrl('educatfuture.png',true)" mode="aspectFit">
					</image>
					<view class="w48"></view>
					<view class="fz32 bold">指点志愿</view>
				</view>
			</view>
			<view class="pb20"></view>
			<view class="pl20 pr20">
				<!-- 广告位 -->
				<image class=" h280 w100b mt20 mb20 ius20" :src="cosImageUrl('banner_bg.png',true)" mode="aspectFill">
				</image>
				<image class="h110 w100b  mb20 ius20" :src="cosImageUrl('banner_bg01.png',true)" mode="aspectFill">
				</image>
				<!-- 公告 -->
				<view class="ius20">
					<u-notice-bar mode="link" :icon="cosImageUrl('notice_icon.png',true)" bgColor="#fff" color="#000"
						:text="removePTags(list&&list.length > 0?list[0]&&list[0].noticeContent:'')"></u-notice-bar>
				</view>
				<!-- 分数模块 -->
				<view class="pb20"></view>
				<view class="bgfff ius20  pl20 pr20 pt20 pb20">
					<view class="flex between alicen bdr1_bottom boree pb20">
						<view class="flex alicen">
							<view class="fz36 bold">{{model1.grade}} <text class="fz24">分</text></view>
							<!-- <view class="fz36 bold ml30">1200<text class="fz24">名</text></view> -->
						</view>
						<view class="flex alicen">
							<view class="fz32 bold mr20">{{model1.sxkm||'--'}}/{{model1.zxkm||'--'}}</view>
							<!-- <u-icon name="edit-pen" color="#ededed" size="28"></u-icon> -->
						</view>
					</view>
					<!-- 志愿表单 -->
					<view class="flex between">
						<view class="flex1  flex column between">
							<view class="colff pt40 pb40 pl30 pr30 bgsize100b no-repeat"
								:style="{ backgroundImage: 'url(' + cosImageUrl('Volunteer1.png',true) + ')' }"
								@click="navgateTo('/pages/generate/generate')">
								<view class="fz36 bold">一键生成志愿</view>
								<view class="fz32 fw500"
									@click="navgateTo('/pages/generateWishInCollege/generateWishInCollege')">根据分数推荐大学
								</view>
								<view class="fz24">1988所</view>
							</view>
							<view class="colff mt10 pt40 pb40 pl30 pr30 bgsize100b no-repeat"
								:style="{ backgroundImage: 'url(' + cosImageUrl('Volunteer2.png',true) + ')' }">
								<view class="">我的志愿表单</view>
								<view class="">定制多种报考方案</view>
							</view>
						</view>
						<view class="flex1 ml20 flex column between ">
							<view class="flex alicen between border1 ius10 borf84746 mb10 pt8 pb8 pl8 pr8"
								@click="navgateTo('/pages/generateWish/generateWish',{pageType:'c',showType:'grade'})">
								<image class="w48 h48 ius10" :src="cosImageUrl('chong.png',true)" mode="aspectFill">
								</image>
								<view class="fz28">可冲击{{all.c||readData('userall').c||0}}</view>
								<u-icon name="arrow-right" color="#f84746" size="18"></u-icon>
							</view>
							<view class="flex alicen between border1 ius10 bor4c85f7 mb10 pt8 pb8 pl8 pr8"
								@click="navgateTo('/pages/generateWish/generateWish',{pageType:'z',showType:'grade'})">
								<image class="w48 h48 ius10" :src="cosImageUrl('zheng.png',true)" mode="aspectFill">
								</image>
								<view class="fz28">可争取{{all.z||readData('userall').z||0}}</view>
								<u-icon name="arrow-right" color="#4c85f7" size="18"></u-icon>
							</view>
							<view class="flex alicen between border1 borff9719 ius10 borff9719 mb10 pt8 pb8 pl8 pr8"
								@click="navgateTo('/pages/generateWish/generateWish',{pageType:'w',showType:'grade'})">
								<image class="w48 h48 ius10" :src="cosImageUrl('wen.png',true)" mode="aspectFill">
								</image>
								<view class="fz28">可以稳{{all.w||readData('userall').w||0}}</view>
								<u-icon name="arrow-right" color="#ff9719" size="18"></u-icon>
							</view>
							<view class="flex alicen between border1 ius10 bor8b1fe7 mb10 pt8 pb8 pl8 pr8"
								@click="navgateTo('/pages/generateWish/generateWish',{pageType:'s',showType:'grade'})">
								<image class="w48 h48 ius10" :src="cosImageUrl('shou.png',true)" mode="aspectFill">
								</image>
								<view class="fz28">可以守{{all.s||readData('userall').s||0}}</view>
								<u-icon name="arrow-right" color="#8b1fe7" size="18"></u-icon>
							</view>
							<view class="flex alicen between border1 ius10 bor03c698 pt8 pb8 pl8 pr8"
								@click="navgateTo('/pages/generateWish/generateWish',{pageType:'b',showType:'grade'})">
								<image class="w48 h48 ius10" :src="cosImageUrl('bao.png',true)" mode="aspectFill">
								</image>
								<view class="fz28">可保底{{all.b||readData('userall').b||0}}</view>
								<u-icon name="arrow-right" color="#03c698" size="18"></u-icon>
							</view>
						</view>
					</view>
				</view>
				<view class="pb20"></view>
				<view class="bgfff ius20  pl20 pr20 pt20 pb20 flex alicen around">
					<view class="txtcen" @click="navgateTo('/pages/generateWish/generateWish')">
						<image class="w80 h80 ius100" :src="cosImageUrl('img1.png',true)" mode="aspectFill"></image>
						<view class="fz28 mt10">找大学</view>
					</view>
					<view class="txtcen" @click="navgateTo('/pages/organize/organize')">
						<image class="w80 h80 ius100" :src="cosImageUrl('img2.png',true)" mode="aspectFill"></image>
						<view class="fz28 mt10">专业组分析</view>
					</view>
					<view class="txtcen" @click="navgateTo('/pages/majorFirst/majorFirst')">
						<image class="w80 h80 ius100" :src="cosImageUrl('img3.png',true)" mode="aspectFill"></image>
						<view class="fz28 mt10">专业分析</view>
					</view>
					<view class="txtcen" @click="navgateTo('/pages/shortcut/shortcut')">
						<image class="w80 h80 ius100" :src="cosImageUrl('img4.png',true)" mode="aspectFill"></image>
						<view class="fz28 mt10">智能填报</view>
					</view>
				</view>

				<view class="pb20"></view>
				<view class="ius20 pl20 pr20  flex bgsize100b no-repeat alicen between"
					:style="{ backgroundImage: 'url(' + cosImageUrl('Infobg.png',true) + ')' }">
					<view class="mt20 mb20">
						<view class="fz36 bold">高考消息</view>
						<view class="fz30 fw500 mt20">高考消息快人一步</view>
					</view>
					<image class="w48b h120" :src="cosImageUrl('infologo.png',true)" mode="aspectFill"></image>
				</view>
				<view class="pb20"></view>
				<view class="">
					<view class="flex alicen between mb10" v-for="(not,i) in news" :key="i"
						@tap.stop="notdetail(not.id)">
						<view class="flex alicen w60b">
							<view class="w10 h10 bgff000 ius100"></view>
							<view class="ml10 w100b fz24 nowrap text-word-break-1">
								<mp-html :content="not.smallTitle" />
							</view>
						</view>
						<view class="nowrap fz24 col99">{{not.createTime}}</view>
					</view>
				</view>
			</view>
		</view>
		<com-noticePop :noticeShow="noticeflag.Show">
			<com-noticetips :title="noticeflag.flag" @login="login"></com-noticetips>
		</com-noticePop>
		<com-tabbar @gomine="gomine"></com-tabbar>
	</view>
</template>

<script>
	import {
		loginMemberByPhone
	} from "@/utils/api/user.js";
	export default {
		data() {
			return {
				list: [], //公告的数组
				all: {},
				news: [], //新闻数组
				model1: {},
			}
		},
		
		onShow() {
			this.userInfo(); //用户信息
			this.notice(); //公告列表
			this.article(); //新闻列表
			this.showSubmit() //分数

		},
		methods: {
			
			async userInfo() {
				let params = {
					useId: this.readData('useId')
				}
				let info = await this.request.get('/api/loginMemberById', {
					params
				})
				if (info.code == 200) {
					this.model1 = info.data
					this.saveData('useId', info.data.id)
					this.saveData('userdata', info.data)

				}
			},
			async notice() {
				let notres = await this.request.get('/api/noticeList');
				if (notres.code == 200) {
					this.list = notres.data
				}
			},
			async article() {
				let params = {
					articleType: '高考信息',
					pageNum: 1,
					userId: this.readData('useId')
				}
				let news = await this.request.get('/api/cmsApi/findArticleList', {
					params
				})
				if (news.code == 200) {
					console.log('news', news)
					this.news = news.rows
				}
			},
			// 分数
			async showSubmit() {
				let params = {
					useId: this.readData('useId')
				}
				let shows = await this.request.get('/api/showSubmit', {
					params
				})
				if (shows.code == 200) {
					this.all = shows.data
					this.saveData('userall', shows.data)
				}
			},
			removePTags(str) {
				return str.replace(/<\/?p>/g, '');
			},
			//判断用户是否登录
			gomine() {
				this.navswitch('/pages/mine/mine')
			},
			notdetail(id) {
				this.navgateTo('/pages/index/notdetail', {
					id: id
				})
			},
			//弹窗按钮事件
			login(flag) {
				if (flag == 'no') return this.noticeflag.Show = false
				if (flag == 'yes') return this.navLaunch('/pages/login/login')
			},
		},
	}
</script>

<style lang="scss">
	page {
		background: #ededed !important;
	}

	.calc150 {
		height: calc(100vh - 150rpx)
	}
</style>